package com.seecen.controller;

import com.seecen.service.ProductService;
import com.seecen.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@RequestMapping("product")
@CrossOrigin
public class ProductController {

    @Autowired
    private ProductService productService;

    // 查询所有上架商品
    @GetMapping("listAllProducts")
    public Result listAllProducts(){
        Result ret = productService.listAllProducts();
        return ret;
    }

    // 根据ID查询商品
    @PostMapping("getProductById")
    public   Result  getProductById(@RequestParam Integer productId){
        Result ret = productService.getProductById(productId);
        return ret;
    }

    //根据id展示详情
    @PostMapping("queryProDetailById")
    public Result queryProDetailById(@RequestParam Integer productId){
        Result ret = productService.queryProDetailById(productId);
        return ret;
    }

}
